import axios from "axios";
//创建axios初始化
const service = axios.create({
    baseURL: '',
    // headers: {
    //     'Content-Type': 'application/json:charset=utf-8'
    // }, 
    timeout: 30000,//超时时间
    withCredentials: true//自动获取cookie信息
})
//request拦截器，发送数据到后台拦截器
service.interceptors.request.use(
    config => {
        return config;
    }, error => {
        Promise.reject(error)
    }
)
//response拦截器
service.interceptors.response.use(
    config => {
        return config.data;
    }, error => {
        Promise.reject(error)
    }
)
export default service;